﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Windows.Forms;

namespace mas_apredizaje
{
    class conexion
    {
        //private string cadena = "Password = 123456789 ; Persist Security Info = True; User ID =sa ; Initial Catalog =masaprendizaje; Data Source=.";
        private string cadena = "Data Source= KEI; Initial Catalog =masApredizaje ; Integrated Security=True";
        
        private SqlConnection conn;

        public void conectar()
        {
            try
            {
                conn = new SqlConnection(cadena);
                conn.Open();

            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
                conn = null;
            }
        }
        public void desconectar()
        {
            try
            {
                conn.Close();
            }
            catch (SqlException ex)
            {
                conn = null;
                MessageBox.Show(ex.Message);
            }
        }
        public SqlConnection conector
        {
            set { }
            get { return conn; }
        }

    }
}
